package com.xcz.demo04;

import com.xcz.demo02.UserService;
import com.xcz.demo02.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        UserServiceImpl userService = new UserServiceImpl();
        ProxyInvocationHandle proxyInvocationHandle = new ProxyInvocationHandle();
        //设置要代理的对象
        proxyInvocationHandle.setTarget(userService);
//        动态生成代理类
        UserService proxy = (UserService) proxyInvocationHandle.getProxy();
        proxy.add();
        proxy.del();
        proxy.update();
        proxy.query();
    }
}
